﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace YY.BLL
{
    public class MainHelp
    {
        private readonly YY.DAL.MainHelp dal = new YY.DAL.MainHelp();
        public MainHelp()
		{}

        /// <summary>
        /// 执行sql语句 返回受影响的行数
        /// </summary>
        /// <param name="strSql"></param>
        /// <returns></returns>
        public int ExecuteSql(string strSql)
        {
            return dal.ExecuteSql(strSql);
        }

        /// <summary>
        /// 执行SQL语句，返回影响的记录数
        /// </summary>
        /// <param name="SQLString">SQL语句</param>
        /// <returns>影响的记录数</returns>
        public int ExecuteSql(string SQLString, params SqlParameter[] cmdParms)
        {
            return dal.ExecuteSql(SQLString, cmdParms);
        }


        public DataSet RunProcedure(string strSql, IDataParameter[] parameters)
        {
            return dal.RunProcedure(strSql, parameters);
        }
        /// <summary>
        /// 执行sql语句 返回DataSet
        /// </summary>
        /// <param name="strSql"></param>
        /// <returns></returns>
        public DataSet Query(string strSql)
        {
            return dal.Query(strSql);
        }

        /// <summary>
        /// 执行多条SQL语句，实现数据库事务。
        /// </summary>
        /// <param name="SQLStringList"></param>
        /// <returns></returns>
        public  int ExecuteSqlTran(List<String> SQLStringList)
        {
            return dal.ExecuteSqlTran(SQLStringList);
        }


        ///// <summary>
        ///// 执行多条SQL语句，实现数据库事务。
        ///// </summary>
        ///// <param name="SQLStringList"></param>
        ///// <returns></returns>
        //public int ExecuteSqlTran(List<String> SQLStringList, out List<int> IDENTITYs)
        //{
        //    return dal.ExecuteSqlTran(SQLStringList, out IDENTITYs);
        //}

        ///// <summary>
        ///// 执行多条SQL语句，实现数据库事务。
        ///// </summary>
        ///// <param name="SQLStringList"></param>
        ///// <returns></returns>
        //public int ExecuteSqlTran(List<String> SQLStringList, ref SqlConnection sqlconnection, ref SqlTransaction sqltransaction)
        //{
        //    return dal.ExecuteSqlTran(SQLStringList,ref sqlconnection,ref sqltransaction);
        //}
        //跨数据库操作
        public DataSet Query(string strSql, string connectionString)
        {
            return dal.Query(strSql, connectionString);
        }
        public object GetSingle(string strSql)
        {
            return dal.GetSingle(strSql);
        }
    }
}
